package com.xbongbong.saas.domain.dao;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.domain.entity.UpdateDataEntity;
import com.xbongbong.saas.domain.entity.ext.ReturnedPurchaseEntityExt;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 采购退货单
 * @author Jian.Wang
 * @date 2019/1/23 20:30
 * @since v1.0
 * @version v1.0
 */
@Repository
@Mapper
public interface ReturnedPurchaseDao{
    /**
     * 插入数据
     *
     * @param returnedPurchaseEntityExt 实体数据
     * @author feng.zheng
     * @date 2019/1/23 20:00
     * @since v1.0
     **/
    Integer insert(ReturnedPurchaseEntityExt returnedPurchaseEntityExt);
    /**
     * 更新数据
     *
     * @param returnedPurchaseEntityExt 采购退货单实体数据
     * @author feng.zheng
     * @date 2019/1/23 20:00
     * @since v1.0
     **/
    Integer update(ReturnedPurchaseEntityExt returnedPurchaseEntityExt);
    /**
     * 更新下更新时间
     * @param updateTime
     * @param id
     * @param corpid
     * @return
     */
    Integer updateTime(@Param("updateTime") Long updateTime, @Param("id") Long id, @Param("corpid") String corpid);
    /**
     * 根据id查询数据
     *
     * @param key 主键
     * @param corpid 公司ID
     * @author feng.zheng
     * @date 2019/1/23 20:00
     * @since v1.0
     **/
    ReturnedPurchaseEntityExt getByKey(@Param("key") Long key, @Param("corpid") String corpid);

    /**
     * 按照条件查询数据
     * @param param 参数
     * @return List<ReturnedPurchaseEntityExt>
     * @date 2019/3/4 Jian.Wang
     * @author Jian.Wang
     */
    List<ReturnedPurchaseEntityExt> findEntitys(@Param("param") Map<String, Object> param);

    /**
     * Description: 根据条件查询数量
     * @param param 参数map
     * @return java.lang.Integer
     */
    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    /**
     * 批量删除
     * @author 吴峰
     * @date 2019/3/8 11:26
     * @param idIn
     * @param corpid
     * @return java.lang.Integer
     * @throws XbbException 业务异常
     */
    Integer deleteBatch(@Param("list") List<Long> idIn,@Param("corpid") String corpid);

    Integer batchUpdateOwner(@Param("list")List<Long> dataIdList, @Param("corpid")String corpid, @Param("ownerId")String userId);

    /**
     * 单个删除
     * @param key
     * @param corpid
     * @return
     */
    Integer deleteByKey(@Param("key") Long key, @Param("corpid") String corpid);

    /**
     * 批量更新
     * @author 吴峰
     * @date 2019/3/15 21:46
     * @param updateList 数据
     * @param corpid 公司id
     * @return java.lang.Integer
     */
    Integer updateBatch(@Param("list")List<UpdateDataEntity> updateList,@Param("corpid") String corpid);

    List<String> getCorpids();

    /**
     * 根据供应商ID查询采购退货单ID集合
     * @param param 参数
     * @return List<ReturnedPurchaseEntityExt>
     * @date 2020/7/22 Jian.Wu
     * @author Jian.Wang
     */
    List<ReturnedPurchaseEntityExt> getBySupplierId(@Param("param") Map<String, Object> param);

}
